package com.lai.shop.vo;

import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * @BelongsPackage: com.lai.shop.vo
 * @Author: laiciqi
 * @CreateTime: 2022-05-24  13:21
 * @Description: 购物项
 * @Version: 1.0
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@ApiModel(description = "订单项Vo")
public class CartItemVo implements Serializable {

    /**
     * 商品id
     */
    private Long productId;

    /**
     * 是否选中
     */
    private Boolean isCheck = true;

    /**
     * 商品名称
     */
    private String productName;

    /**
     * 商品图片
     */
    private String picture;

    /**
     * 商品价格
     */
    private BigDecimal price;

    /**
     * 数量
     */
    private Integer count;

    /**
     * 总价
     */
    private BigDecimal totalPrice;

    public BigDecimal getTotalPrice() {
        return price.multiply(new BigDecimal(count.toString()));
    }
}
